package com.water.listener;

import java.util.Properties;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import org.springframework.core.io.support.PropertiesLoaderUtils;

public class WaterContextLoaderListener implements ServletContextListener {

	public void contextInitialized(ServletContextEvent arg0) {
		try {
			Resource resource = new ClassPathResource("/configInfo.properties");
			Properties props = PropertiesLoaderUtils.loadProperties(resource);
			Config.init(props);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	public void contextDestroyed(ServletContextEvent arg0) {
		// TODO Auto-generated method stub

	}

}
